package com.cnbot.aimolib.db;



import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by uriah on 17-7-10.
 * @author wzz
 */

public class AiMoFaceDbHelper extends SQLiteOpenHelper {
    /**
     * 数据库名字
     */
    private static final String DB_NAME = "face.db";
    /**
     * 表名
     */
    public static String TABLE_NAME = "user_feature";
    /**
     * 列名,主键
     */
    public static String FIELD_ID = "_id";
    public static String FIELD_FEATURE = "feature";
    public static String FIELD_PATH = "path";
    public static String FIELD_USERID = "user_id";
    /**
     * // 数据库版本
     */
    private static final int DB_VERSION = 1;

    public AiMoFaceDbHelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
    }

    /**
     * 创建数据库
     * @param db
     */
    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + "("
                + FIELD_ID + " integer primary key autoincrement , "
                + FIELD_PATH + " text NOT NULL,"
                + FIELD_FEATURE + " BLOB,"
                + FIELD_USERID + " text);";
        db.execSQL(sql);
    }

    /**
     * 数据库升级
     * @param db
     * @param oldVersion
     * @param newVersion
     */
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }

}